TEST
Section: Misc. Reference Manual Pages (1
)
Index
Return to Main Contents
NAME
test - test a logical condition
SYNOPSIS
test
expression
[
]
]
DESCRIPTION
The
test
program tests a logical condition. If that condition is true, it exits
with a value of EXIT_SUCCESS, and with EXIT_FAILURE otherwise. An optional
]
at the end of teh expression is swallowed. This makes it easy to install
test with a link from
[,
so that certain incompatibly written shell files work.
test
understands the following expressions:
- num1
-
True if
num1
and
num2
are both numbers and are equal
- num1
-
True if
num1
and
num2
are both numbers and are not equal
- num1
-
True if
num1
and
num2
are both numbers and
num1
is numerically greater than or equal to
num2
- num1
-
True if
num1
and
num2
are both numbers and
num1
is numerically greater than
num2
- num1
-
True if
num1
and
num2
are both numbers and
num1
is numerically less than or equal to
num2
- num1
-
True if
num1
and
num2
are both numbers and
num1 is numerically less than
num2
- str1
-
True if
str1
and
str2
are equal strings
- str1
-
True if
str1
and
str2
are unequal strings
- str1
-
True if
str1
and
str2
are equal or if
str1
comes lexicographically after
str2,
in the machine's native character set ordering
- str1
-
True if
str1
comes lexicographically after
str2,
in the machine's native character set ordering
- str1
-
True if
str1
and
str2
are equal or if
str1
comes lexicographically before
str2,
in the machine's native character set ordering
- str1
-
True if
str1 comes lexicographically before
str2,
in the machine's native character set ordering
- -e
-
True if
file
exists
- -f
-
True if
file
exists and is a regular file
- -d
-
True if
file
exists and is a directory
- -b
-
True if
file
exists and is a block special file
- -c
-
True if
file
exists and is a character special file
- -l
-
True if
file
exists and is a symbolic link
- -F
-
True if
file
exists and is a fifo
- -r
-
True if
file
exists and is readable by the caller
- -w
-
True if
file
exists and is writable by the caller
- -x
-
True if
file
exists and is executable by the caller
FILES
The file
- COPYING
-
Tells the copying conditions for this program.
BUGS
For the moment, there is no way to make better string comparisons, for
example, by looking at the locale, or offering options to compare strings
as case-insensitive etc.
AUTHOR
test
was written by Stephan Neuhaus (neuhaus@informatik.uni-kl.de), and last
modified on 2 May, 1992.
COPYRIGHT
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 1, or (at your option)
any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License (contained in the file COPYING) for
more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
Index
- NAME
-
- SYNOPSIS
-
- DESCRIPTION
-
- FILES
-
- BUGS
-
- AUTHOR
-
- COPYRIGHT
-
This document was created by
man2html,
using the manual pages.
Time: 17:10:38 GMT, January 31, 2023